package com.qzsoft.zhjd.asphalt.modules.nAsphaltDataConfig.controller;

import java.util.Arrays;
import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qzsoft.jeemis.common.utils.Result;
import com.qzsoft.zhjd.asphalt.modules.nAsphaltDataConfig.entity.NAsphaltDataConfigEntity;
import com.qzsoft.zhjd.asphalt.modules.nAsphaltDataConfig.service.NAsphaltDataConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;



/**
 * 沥青理论用量辅助表
 *
 * @author sx
 * @email 
 * @date 2024-07-22 14:26:00
 */
@RestController
@RequestMapping("qualitySupervisionControl/nAsphaltDataConfig")
public class NAsphaltDataConfigController {

    @Autowired
    private NAsphaltDataConfigService nAsphaltDataConfigService;

    /**
     * 列表
     */
    @RequestMapping("/page")
    @RequiresPermissions("qualitySupervisionControl:nAsphaltDataConfig:page")
    public Result page(@RequestParam Map<String, Object> params){
        IPage page = nAsphaltDataConfigService.queryPage(params);
        return new Result().ok(page);
    }


    /**
     * 信息
     */
    @RequestMapping("/find/{id}")
    @RequiresPermissions("qualitySupervisionControl:nAsphaltDataConfig:find")
    public Result find(@PathVariable("id") Long id){
		NAsphaltDataConfigEntity nAsphaltDataConfig = nAsphaltDataConfigService.getInfo(id);
        return new Result().ok(nAsphaltDataConfig);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("qualitySupervisionControl:nAsphaltDataConfig:save")
    public Result save(@RequestBody NAsphaltDataConfigEntity nAsphaltDataConfig){
		nAsphaltDataConfigService.saveData(nAsphaltDataConfig);
        return new Result().ok("");
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("qualitySupervisionControl:nAsphaltDataConfig:update")
    public Result update(@RequestBody NAsphaltDataConfigEntity nAsphaltDataConfig){
        nAsphaltDataConfigService.updateData(nAsphaltDataConfig);
        return new Result().ok("");
    }


    /**
     * 删除单个
     */
    @RequestMapping("/delete/{id}")
    @RequiresPermissions("qualitySupervisionControl:nAsphaltDataConfig:delete")
    public Result deleteOne(@PathVariable("id") Long id){
        nAsphaltDataConfigService.deleteOneData(id);
        return new Result().ok("");
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("qualitySupervisionControl:nAsphaltDataConfig:delete")
    public Result delete(@RequestBody Long[] ids){
        nAsphaltDataConfigService.deleteData(Arrays.asList(ids));
        return new Result().ok("");
    }
}
